<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   如何将 MapReduce 转化为 Spark  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://dataunion.org/19040.html",
                  host: "http://dataunion.org",
                  prePath: "http://dataunion.org",
                  scheme: "http",
                  pathBase: "http://dataunion.org/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466459524: Accept with keywords: (title(0.333333333333):Spark,数盟,社区, topn(0.433333333333):作业,Hadoop,流式,任务,内存,数据挖掘,数量,模型,hadoop,引擎,键值,计算,文章,数据处理,Spark,数据,节点,场景,函数,数盟,spark,字符,方式,方法,代码,系统,应用程序,集群,交互式,分布式).-->
 </head>
 <body onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    如何将 MapReduce 转化为 Spark
   </h1>
  </div>
  <div class="container" id="xmain">
   ﻿﻿
   <title>
    如何将 MapReduce 转化为 Spark | 数盟社区
   </title>
   <!-- All in One SEO Pack 2.2.7.6.2 by Michael Torbert of Semper Fi Web Design[32,70] -->
   <!-- /all in one seo pack -->
   <!--
<div align="center">
<a href="http://strata.oreilly.com.cn/hadoop-big-data-cn?cmp=mp-data-confreg-home-stcn16_dataunion_pc" target="_blank"><img src="http://dataunion.org/wp-content/uploads/2016/05/stratabj.jpg"/ ></a>
</div>
-->
   <header id="header-web">
    <div class="header-main">
     <hgroup class="logo">
      <h1>
       <a href="http://dataunion.org/" rel="home" title="数盟社区">
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/logo.png"/>
       </a>
      </h1>
     </hgroup>
     <!--logo-->
     <nav class="header-nav">
      <ul class="menu" id="menu-%e4%b8%bb%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-71" id="menu-item-71">
        <a href="http://dataunion.org/category/events" title="events">
         活动
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22457" id="menu-item-22457">
          <a href="http://dataunion.org/2016timeline">
           2016档期
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22459" id="menu-item-22459">
          <a href="http://dataunion.org/category/parterc">
           合作会议
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-has-children menu-item-20869" id="menu-item-20869">
        <a href="http://dataunion.org/category/tech" title="articles">
         文章
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20867" id="menu-item-20867">
          <a href="http://dataunion.org/category/tech/base" title="base">
           基础架构
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3302" id="menu-item-3302">
          <a href="http://dataunion.org/category/tech/ai" title="ai">
           人工智能
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3303" id="menu-item-3303">
          <a href="http://dataunion.org/category/tech/analysis" title="analysis">
           数据分析
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21920" id="menu-item-21920">
          <a href="http://dataunion.org/category/tech/dm">
           数据挖掘
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3314" id="menu-item-3314">
          <a href="http://dataunion.org/category/tech/viz" title="viz">
           可视化
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3305" id="menu-item-3305">
          <a href="http://dataunion.org/category/tech/devl" title="devl">
           编程语言
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-20876" id="menu-item-20876">
        <a href="http://dataunion.org/category/industry">
         行业
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-16328" id="menu-item-16328">
          <a href="http://dataunion.org/category/industry/case" title="case">
           行业应用
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-2112" id="menu-item-2112">
          <a href="http://dataunion.org/category/industry/demo" title="demo">
           Demo展示
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21562" id="menu-item-21562">
          <a href="http://dataunion.org/category/industry/news">
           行业资讯
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-311" id="menu-item-311">
        <a href="http://dataunion.org/category/sources" title="sources">
         资源
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20870" id="menu-item-20870">
        <a href="http://dataunion.org/category/books" title="book">
         图书
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21363" id="menu-item-21363">
        <a href="http://dataunion.org/category/training">
         课程
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-21853" id="menu-item-21853">
        <a href="http://dataunion.org/category/jobs">
         职位
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22050" id="menu-item-22050">
          <a href="http://dataunion.org/category/career">
           职业规划
          </a>
         </li>
        </ul>
       </li>
      </ul>
     </nav>
     <!--header-nav-->
    </div>
   </header>
   <!--header-web-->
   <div id="main">
    <div id="soutab">
     <form action="http://dataunion.org/" class="search" method="get">
     </form>
    </div>
    <div id="container">
     <nav id="mbx">
      当前位置：
      <a href="http://dataunion.org">
       首页
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech">
       文章
      </a>
      &gt;  正文
     </nav>
     <!--mbx-->
     <article class="content">
      <header align="centre" class="contenttitle">
       <div class="mscc">
        <h1 class="mscctitle">
         <a href="http://dataunion.org/19040.html">
          如何将 MapReduce 转化为 Spark
         </a>
        </h1>
        <address class="msccaddress ">
         <em>
          1,861 次阅读 -
         </em>
         <a href="http://dataunion.org/category/tech" rel="category tag">
          文章
         </a>
        </address>
       </div>
      </header>
      <div class="content-text">
       <p>
        作者：
        <a class="ibm-popup-link" href="http://www.ibm.com/developerworks/cn/opensource/os-cn-mapreduce-spark/index.html#authorN10015">
         周明耀
        </a>
        出处：
        <a href="http://www.ibm.com/developerworks/cn/">
         developerWorks 中国
        </a>
       </p>
       <div class="ibm-columns">
        <div class="ibm-col-1-1">
         <h2 id="1.MapReduce VS Spark|outline">
          MapReduce VS Spark
         </h2>
         <p>
          目前的大数据处理可以分为以下三个类型：
         </p>
         <ul class="ibm-bullet-list">
          <li>
           复杂的批量数据处理（batch data processing），通常的时间跨度在数十分钟到数小时之间；
          </li>
          <li>
           基于历史数据的交互式查询（interactive query），通常的时间跨度在数十秒到数分钟之间；
          </li>
          <li>
           基于实时数据流的数据处理（streaming data processing），通常的时间跨度在数百毫秒到数秒之间。
          </li>
         </ul>
         <p>
          大数据处理势必需要依赖集群环境，而集群环境有三大挑战，分别是并行化、单点失败处理、资源共享，分别可以采用以并行化的方式重写应用程序、对单点失败的处理方式、动态地进行计算资源的分配等解决方案来面对挑战。
         </p>
         <p>
          针对集群环境出现了大量的大数据编程框架，首先是 Google 的 MapReduce，它给我们展示了一个简单通用和自动容错的批处理计算模型。但是对于其他类型的计算，比如交互式和流式计算，MapReduce 并不适合。这也导致了大量的不同于 MapReduce 的专有的数据处理模型的出现，比如 Storm、Impala 等等。但是这些专有系统也存在一些不足：
         </p>
         <ol type="1">
          <li>
           重复工作：许多专有系统在解决同样的问题，比如分布式作业以及容错，举例来说，一个分布式的 SQL 引擎或者一个机器学习系统都需要实现并行聚合，这些问题在每个专有系统中会重复地被解决。
          </li>
          <li>
           组合问题：在不同的系统之间进行组合计算是一件麻烦的事情。对于特定的大数据应用程序而言，中间数据集是非常大的，而且移动的成本很高。在目前的环境下，我们需要将数据复制到稳定的存储系统，比如 HDFS，以便在不同的计算引擎中进行分享。然而，这样的复制可能比真正的计算所花费的代价要大，所以以流水线的形式将多个系统组合起来效率并不高。
          </li>
          <li>
           适用范围的局限性：如果一个应用不适合一个专有的计算系统，那么使用者只能换一个系统，或者重写一个新的计算系统。
          </li>
          <li>
           资源分配：在不同的计算引擎之间进行资源的动态共享比较困难，因为大多数的计算引擎都会假设它们在程序运行结束之前拥有相同的机器节点的资源。
          </li>
          <li>
           管理问题：对于多个专有系统，需要花费更多的精力和时间来管理和部署，尤其是对于终端使用者而言，需要学习多种 API 和系统模型。
          </li>
         </ol>
         <p>
          Spark 是伯克利大学推出的大数据处理框架，它提出了 RDD 概念 (Resilient Distributed Datasets)，即抽象的弹性数据集概念。Spark 是对 MapReduce 模型的一种扩展。要在 MapReduce 上实现其不擅长的计算工作 (比如迭代式、交互式和流式)，是比较困难的，因为 MapReduce 缺少在并行计算的各个阶段进行有效的数据共享的能力，而这种能力是 RDD 的本质所在。利用这种有效地数据共享和类似 MapReduce 的操作接口，上述的各种专有类型计算都能够有效地表达，而且能够获得与专有系统同等的性能。
         </p>
         <div class="ibm-alternate-rule">
         </div>
         <h2 id="2.MapReduce 和 Spark 介绍|outline">
          MapReduce 和 Spark 介绍
         </h2>
         <h3 id="2.1.MapReduce|outline">
          MapReduce
         </h3>
         <p>
          MapReduce 是为 Apache Hadoop 量身订做的，它非常适用于 Hadoop 的使用场景，即大规模日志处理系统、批量数据提取加载工具 (ETL 工具) 等类似操作。但是伴随着 Hadoop 地盘的不断扩张，Hadoop 的开发者们发现 MapReduce 在很多场景下并不是最佳选择，于是 Hadoop 开始把资源管理放入到自己独立的组件 YARN 里面。此外，类似于 Impala 这样的项目也开始逐渐进入到我们的架构中，Impala 提供 SQL 语义，能查询存储在 Hadoop 的 HDFS 和 HBase 中的 PB 级大数据。之前也有类似的项目，例如 Hive。Hive 系统虽然也提供了 SQL 语义，但由于 Hive 底层执行使用的是 MapReduce 引擎，仍然是一个批处理过程，难以满足查询的交互性。相比之下，Impala 的最大特点也是最大卖点就是它的效率。
         </p>
         <p>
          第一代 Hadoop MapReduce 是一个在计算机集群上分布式处理海量数据集的软件框架，包括一个 JobTracker 和一定数量的 TaskTracker。运行流程图如图 1 所示。
         </p>
         <h5 id="3.1.1. 图 1. MapReduce 运行流程图|outline">
          图 1. MapReduce 运行流程图
         </h5>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2015/05/img001.jpg"/>
          在最上层有 4 个独立的实体，即客户端、jobtracker、tasktracker 和分布式文件系统。客户端提交 MapReduce 作业；jobtracker 协调作业的运行；jobtracker 是一个 Java 应用程序，它的主类是 JobTracker；tasktracker 运行作业划分后的任务，tasktracker 也是一个 Java 应用程序，它的主类是 TaskTracker。Hadoop 运行 MapReduce 作业的步骤主要包括提交作业、初始化作业、分配任务、执行任务、更新进度和状态、完成作业等 6 个步骤。
         </p>
         <h3 id="2.2.Spark 简介|outline">
          Spark 简介
         </h3>
         <p>
          Spark 生态系统的目标就是将批处理、交互式处理、流式处理融合到一个软件框架内。Spark 是一个基于内存计算的开源的集群计算系统，目的是让数据分析更加快速。Spark 非常小巧玲珑，由加州伯克利大学 AMP 实验室的 Matei 为主的小团队所开发。使用的语言是 Scala，项目的 core 部分的代码只有 63 个 Scala 文件，非常短小精悍。Spark 启用了内存分布数据集，除了能够提供交互式查询外，它还可以优化迭代工作负载。Spark 提供了基于内存的计算集群，在分析数据时将数据导入内存以实现快速查询，速度比基于磁盘的系统，如 Hadoop 快很多。Spark 最初是为了处理迭代算法，如机器学习、图挖掘算法等，以及交互式数据挖掘算法而开发的。在这两种场景下，Spark 的运行速度可以达到 Hadoop 的几百倍。
         </p>
         <p>
          Spark 允许应用在内存中保存工作集以便高效地重复利用，它支持多种数据处理应用，同时也保持了 MapReduce 的重要特性，如高容错性、数据本地化、大规模数据处理等。此外，提出了弹性分布式数据集 (Resilient Distributed Datasets) 的概念：
         </p>
         <ol type="1">
          <li>
           RDD 表现为一个 Scala 对象，可由一个文件创建而来；
          </li>
          <li>
           分布在一个集群内的，不可变的对象切分集；
          </li>
          <li>
           通过并行处理（map、filter、groupby、join）固定数据（BaseRDD）创建模型，生成 Transformed RDD；
          </li>
          <li>
           故障时可使用 RDD 血统信息重建；
          </li>
          <li>
           可高速缓存，以便再利用。
          </li>
         </ol>
         <p>
          图 2 所示是一个日志挖掘的示例代码，首先将日志数据中的 error 信息导入内存，然后进行交互搜索。
         </p>
         <h5 id="3.1.1. 图 2. RDD 代码示例|outline">
          图 2. RDD 代码示例
         </h5>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2015/05/img002.jpg"/>
          在导入数据时，模型以 block 形式存在于 worker 上，由 driver 向 worker 分发任务，处理完后 work 向 driver 反馈结果。也可在 work 上对数据模型建立高速缓存 cache，对 cache 的处理过程与 block 类似，也是一个分发、反馈的过程。
         </p>
         <p>
          Spark 的 RDD 概念能够取得和专有系统同样的性能，还能提供包括容错处理、滞后节点处理等这些专有系统缺乏的特性。
         </p>
         <ol type="1">
          <li>
           迭代算法：这是目前专有系统实现的非常普遍的一种应用场景，比如迭代计算可以用于图处理和机器学习。RDD 能够很好地实现这些模型，包括 Pregel、HaLoop 和 GraphLab 等模型。
          </li>
          <li>
           关系型查询：对于 MapReduce 来说非常重要的需求就是运行 SQL 查询，包括长期运行、数小时的批处理作业和交互式的查询。然而对于 MapReduce 而言，对比并行数据库进行交互式查询，有其内在的缺点，比如由于其容错的模型而导致速度很慢。利用 RDD 模型，可以通过实现许多通用的数据库引擎特性，从而获得很好的性能。
          </li>
          <li>
           MapReduce 批处理：RDD 提供的接口是 MapReduce 的超集，所以 RDD 能够有效地运行利用 MapReduce 实现的应用程序，另外 RDD 还适合更加抽象的基于 DAG 的应用程序。
          </li>
          <li>
           流式处理：目前的流式系统也只提供了有限的容错处理，需要消耗系统非常大的拷贝代码或者非常长的容错时间。特别是在目前的系统中，基本都是基于连续计算的模型，常住的有状态的操作会处理到达的每一条记录。为了恢复失败的节点，它们需要为每一个操作复制两份操作，或者将上游的数据进行代价较大的操作重放，利用 RDD 实现离散数据流，可以克服上述问题。离散数据流将流式计算当作一系列的短小而确定的批处理操作，而不是常驻的有状态的操作，将两个离散流之间的状态保存在 RDD 中。离散流模型能够允许通过 RDD 的继承关系图进行并行性的恢复而不需要进行数据拷贝。
          </li>
         </ol>
         <h3 id="2.3.Spark 内部术语解释|outline">
          Spark 内部术语解释
         </h3>
         <p>
          Application：基于 Spark 的用户程序，包含了 driver 程序和集群上的 executor；
         </p>
         <p>
          Driver Program：运行 main 函数并且新建 SparkContext 的程序；
         </p>
         <p>
          Cluster Manager：在集群上获取资源的外部服务 (例如:standalone,Mesos,Yarn)；
         </p>
         <p>
          Worker Node：集群中任何可以运行应用代码的节点；
         </p>
         <p>
          Executor：是在一个 worker node 上为某应用启动的一个进程，该进程负责运行任务，并且负责将数据存在内存或者磁盘上。每个应用都有各自独立的 executors；
         </p>
         <p>
          Task：被送到某个 executor 上的工作单元；
         </p>
         <p>
          Job：包含很多任务的并行计算，可以与 Spark 的 action 对应；
         </p>
         <p>
          Stage：一个 Job 会被拆分很多组任务，每组任务被称为 Stage(就像 Mapreduce 分 map 任务和 reduce 任务一样)。
         </p>
         <div class="ibm-alternate-rule">
         </div>
         <h2 id="3.SparkDemo 程序运行|outline">
          SparkDemo 程序运行
         </h2>
         <p>
          Spark 源代码可以在 http://spark-project.org/download 处下载，也可以到 github 直接复制 Spark 项目。Spark 提供基本源码压缩包，同时也提供已经编译好的压缩包。Spark 是通过 Scala Shell 来与外界进行交互的。
         </p>
         <p>
          开始安装，推荐的方法是首先在第一个节点上部署和启动 master，获取 master spark url，然后在部署到其他节点之前修改 conf/spark-env.sh 中的内容。
         </p>
         <p>
          开始单机 master 服务：./bin/start-master.sh
         </p>
         <p>
          下载了 spark-0.9.1-bin-cdh4 后上传到/home/zhoumingyao 目录 (可以自定义目录，本例使用的是 CentosV6.5 操作系统) 下，具体子目录如清单 1 所示。
         </p>
         <h5 id="3.0.1. 清单 1. 目录列表|outline">
          清单 1. 目录列表
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768658019316762685001" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              -rw-r--r-- 1 root root 3899 3 月 27 13:36 README.md
-rw-r--r-- 1 root root 25379 3 月 27 13:36 pom.xml
-rw-r--r-- 1 root root 162 3 月 27 13:36 NOTICE
-rw-r--r-- 1 root root 4719 3 月 27 13:36 make-distribution.sh
-rw-r--r-- 1 root root 21118 3 月 27 13:36 LICENSE
-rw-r--r-- 1 root root 127117 3 月 27 13:36 CHANGES.txt
drwxr-xr-x 4 root root 4096 5 月 6 13:35 assembly
drwxr-xr-x 4 root root 4096 5 月 6 13:36 bagel
drwxr-xr-x 2 root root 4096 5 月 6 13:36 bin
drwxr-xr-x 2 root root 4096 5 月 6 13:36 conf
drwxr-xr-x 4 root root 4096 5 月 6 13:37 core
drwxr-xr-x 2 root root 4096 5 月 6 13:37 data
drwxr-xr-x 4 root root 4096 5 月 6 13:37 dev
drwxr-xr-x 3 root root 4096 5 月 6 13:37 docker
drwxr-xr-x 7 root root 4096 5 月 6 13:37 docs
drwxr-xr-x 4 root root 4096 5 月 6 13:37 ec2
drwxr-xr-x 4 root root 4096 5 月 6 13:37 examples
drwxr-xr-x 7 root root 4096 5 月 6 13:38 external
drwxr-xr-x 3 root root 4096 5 月 6 13:38 extras
drwxr-xr-x 5 root root 4096 5 月 6 13:38 graphx
drwxr-xr-x 5 root root 4096 5 月 6 13:38 mllib
drwxr-xr-x 3 root root 4096 5 月 6 13:38 project
drwxr-xr-x 6 root root 4096 5 月 6 13:38 python
drwxr-xr-x 4 root root 4096 5 月 6 13:38 repl
drwxr-xr-x 2 root root 4096 5 月 6 13:38 sbin
drwxr-xr-x 2 root root 4096 5 月 6 13:38 sbt
drwxr-xr-x 4 root root 4096 5 月 6 13:39 streaming
drwxr-xr-x 3 root root 4096 5 月 6 13:39 target
drwxr-xr-x 4 root root 4096 5 月 6 13:39 tools
drwxr-xr-x 5 root root 4096 5 月 6 13:39 yarn
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-1">
                   1
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-2">
                   2
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-3">
                   3
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-4">
                   4
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-5">
                   5
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-6">
                   6
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-7">
                   7
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-8">
                   8
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-9">
                   9
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-10">
                   10
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-11">
                   11
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-12">
                   12
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-13">
                   13
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-14">
                   14
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-15">
                   15
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-16">
                   16
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-17">
                   17
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-18">
                   18
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-19">
                   19
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-20">
                   20
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-21">
                   21
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-22">
                   22
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-23">
                   23
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-24">
                   24
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-25">
                   25
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-26">
                   26
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-27">
                   27
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-28">
                   28
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019316762685001-29">
                   29
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019316762685001-30">
                   30
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-5768658019316762685001-1">
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    rw
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    r
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-v">
                    r
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    3899
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    3
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    27
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    36
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    README
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    md
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-2">
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    rw
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    r
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-v">
                    r
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    25379
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    3
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    27
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    36
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    pom
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    xml
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-3">
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    rw
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    r
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-v">
                    r
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    162
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    3
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    27
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    36
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    NOTICE
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-4">
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    rw
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    r
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-v">
                    r
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4719
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    3
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    27
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    36
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    make
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    distribution
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    sh
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-5">
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    rw
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    r
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-v">
                    r
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    21118
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    3
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    27
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    36
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    LICENSE
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-6">
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    rw
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    r
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-v">
                    r
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    127117
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    3
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    27
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    36
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    CHANGES
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    txt
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-7">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    35
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    assembly
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-8">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    36
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    bagel
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-9">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    2
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    36
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    bin
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-10">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    2
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    36
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    conf
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-11">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    37
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    core
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-12">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    2
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    37
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    data
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-13">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    37
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    dev
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-14">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    3
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    37
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    docker
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-15">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    7
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    37
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    docs
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-16">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    37
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    ec2
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-17">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    37
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    examples
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-18">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    7
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    38
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    external
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-19">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    3
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    38
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    extras
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-20">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    38
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    graphx
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-21">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    38
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    mllib
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-22">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    3
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    38
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    project
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-23">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    38
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    python
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-24">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    38
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    repl
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-25">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    2
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    38
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    sbin
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-26">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    2
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    38
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    sbt
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-27">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    39
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    streaming
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-28">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    3
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    39
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    target
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019316762685001-29">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    39
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    tools
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019316762685001-30">
                   <span class="crayon-v">
                    drwxr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    xr
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    x
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    root
                   </span>
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4096
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-h">
                   </span>
                   月
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    6
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    13
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    39
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    yarn
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0764 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <p>
          进入 bin 目录，执行 spark-shell.sh，进入 scala shell 状态，如清单 2 所示。
         </p>
         <h5 id="3.0.2. 清单 2. 运行命令|outline">
          清单 2. 运行命令
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768658019328815682229" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              scala&amp;gt; val data = Array(1, 2, 3, 4, 5) //产生 data
data: Array[Int] = Array(1, 2, 3, 4, 5)
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-5768658019328815682229-1">
                   1
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019328815682229-2">
                   2
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-5768658019328815682229-1">
                   <span class="crayon-v">
                    scala
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    val
                   </span>
                   <span class="crayon-v">
                    data
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    =
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    Array
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    2
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    3
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-c">
                    //产生 data
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019328815682229-2">
                   <span class="crayon-v">
                    data
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    Array
                   </span>
                   <span class="crayon-sy">
                    [
                   </span>
                   <span class="crayon-t">
                    Int
                   </span>
                   <span class="crayon-sy">
                    ]
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    =
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    Array
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    2
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    3
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    4
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    5
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0102 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <p>
          下面开始将 data 处理成 RDD，如清单 3 所示。
         </p>
         <h5 id="3.0.3. 清单 3. 处理成 RDD|outline">
          清单 3. 处理成 RDD
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576865801932f974289148" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              scala&amp;gt; val distData = sc.parallelize(data) //将 data 处理成 RDD
distData: spark.RDD[Int] = spark.ParallelCollection@7a0ec850（显示出的类型为 RDD）
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-576865801932f974289148-1">
                   1
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801932f974289148-2">
                   2
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-576865801932f974289148-1">
                   <span class="crayon-v">
                    scala
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    val
                   </span>
                   <span class="crayon-v">
                    distData
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    =
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    sc
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    parallelize
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-v">
                    data
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-c">
                    //将 data 处理成 RDD
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801932f974289148-2">
                   <span class="crayon-v">
                    distData
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    RDD
                   </span>
                   <span class="crayon-sy">
                    [
                   </span>
                   <span class="crayon-t">
                    Int
                   </span>
                   <span class="crayon-sy">
                    ]
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    =
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    ParallelCollection
                   </span>
                   <span class="crayon-sy">
                    @
                   </span>
                   <span class="crayon-cn">
                    7a0ec850
                   </span>
                   （显示出的类型为
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-i">
                    RDD
                   </span>
                   ）
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0018 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <h5 id="3.0.4. 清单 4. 在 RDD 上运算|outline">
          清单 4. 在 RDD 上运算
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768658019336636247836" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              scala&amp;gt; distData.reduce(_+_) //在 RDD 上进行运算，对 data 里面元素进行加和
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-5768658019336636247836-1">
                   1
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-5768658019336636247836-1">
                   <span class="crayon-v">
                    scala
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    distData
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    reduce
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-v">
                    _
                   </span>
                   <span class="crayon-o">
                    +
                   </span>
                   <span class="crayon-v">
                    _
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-c">
                    //在 RDD 上进行运算，对 data 里面元素进行加和
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0010 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <h5 id="3.0.5. 清单 5. 启动 Spark|outline">
          清单 5. 启动 Spark
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576865801933c010320770" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              [root@facenode1 sbin]# ./start-all.sh
starting org.apache.spark.deploy.master.Master, 
     logging to /home/zhoumingyao/spark-0.9.1-bin-cdh4/sbin/../logs/
       spark-root-org.apache.spark.deploy.master.Master-1-facenode1.out
localhost: Warning: Permanently added 'localhost' (RSA) 
   to the list of known hosts.localhost:
     starting org.apache.spark.deploy.worker.Worker, logging to 
     /home/zhoumingyao/spark-0.9.1-bin-cdh4/sbin/../
       logs/spark-root-org.apache.spark.deploy.worker.Worker-1-facenode1.out
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-576865801933c010320770-1">
                   1
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801933c010320770-2">
                   2
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801933c010320770-3">
                   3
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801933c010320770-4">
                   4
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801933c010320770-5">
                   5
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801933c010320770-6">
                   6
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801933c010320770-7">
                   7
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801933c010320770-8">
                   8
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801933c010320770-9">
                   9
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-576865801933c010320770-1">
                   <span class="crayon-sy">
                    [
                   </span>
                   <span class="crayon-v">
                    root
                   </span>
                   <span class="crayon-sy">
                    @
                   </span>
                   <span class="crayon-e">
                    facenode1
                   </span>
                   <span class="crayon-v">
                    sbin
                   </span>
                   <span class="crayon-sy">
                    ]
                   </span>
                   <span class="crayon-p">
                    # ./start-all.sh
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801933c010320770-2">
                   <span class="crayon-e">
                    starting
                   </span>
                   <span class="crayon-v">
                    org
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    apache
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    deploy
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    master
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    Master
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801933c010320770-3">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    logging
                   </span>
                   <span class="crayon-st">
                    to
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    home
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    zhoumingyao
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-cn">
                    0.9.1
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    bin
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    cdh4
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    sbin
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    logs
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801933c010320770-4">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    root
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    org
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    apache
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    deploy
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    master
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    Master
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    facenode1
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    out
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801933c010320770-5">
                   <span class="crayon-v">
                    localhost
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    Warning
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    Permanently
                   </span>
                   <span class="crayon-i">
                    added
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-s">
                    'localhost'
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-v">
                    RSA
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-h">
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801933c010320770-6">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-st">
                    to
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    the
                   </span>
                   <span class="crayon-e">
                    list
                   </span>
                   <span class="crayon-e">
                    of
                   </span>
                   <span class="crayon-e">
                    known
                   </span>
                   <span class="crayon-v">
                    hosts
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    localhost
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801933c010320770-7">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    starting
                   </span>
                   <span class="crayon-v">
                    org
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    apache
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    deploy
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    worker
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    Worker
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    logging
                   </span>
                   <span class="crayon-st">
                    to
                   </span>
                   <span class="crayon-h">
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801933c010320770-8">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    home
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    zhoumingyao
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-cn">
                    0.9.1
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    bin
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    cdh4
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    sbin
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801933c010320770-9">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    logs
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    root
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    org
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    apache
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    deploy
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    worker
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    Worker
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    facenode1
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    out
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0117 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <h5 id="3.0.6. 清单 6. 查看服务|outline">
          清单 6. 查看服务
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768658019343587452038" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              [root@facenode1 sbin]# ps -ef | grep spark
root 29295 1 11 16:45 pts/1 00:00:03 /usr/java/jdk1.6.0_31/bin/java 
       -cp :/home/zhoumingyao/spark-0.9.1-bin-cdh4/conf:/home/
           zhoumingyao/spark-0.9.1-bin-cdh4/assembly/target/scala-2.10/
              spark-assembly_2.10-0.9.1-hadoop2.0.0-mr1-cdh4.2.0.jar:/etc/alternatives/
                hadoopconf -Dspark.akka.logLifecycleEvents=true -Djava.library.path= -Xms512m -Xmx512m 
                 org.apache.spark.deploy.master.Master --ip facenode1 --port 7077 --webui-port 8080
root 29440 1 12 16:45 ? 00:00:03 java -cp :/home/zhoumingyao/
    spark-0.9.1-bin-cdh4/conf:/home/zhoumingyao/spark-0.9.1-bin-cdh4/
      assembly/target/scala-2.10/spark-assembly_2.10-0.9.1-hadoop2.0.0-mr1-cdh4.2.0.jar 
          -Dspark.akka.logLifecycleEvents=true -Djava.library.path= -Xms512m -Xmx512m 
             org.apache.spark.deploy.worker.Worker spark://facenode1:7077
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-5768658019343587452038-1">
                   1
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019343587452038-2">
                   2
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019343587452038-3">
                   3
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019343587452038-4">
                   4
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019343587452038-5">
                   5
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019343587452038-6">
                   6
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019343587452038-7">
                   7
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019343587452038-8">
                   8
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019343587452038-9">
                   9
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019343587452038-10">
                   10
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019343587452038-11">
                   11
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019343587452038-12">
                   12
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-5768658019343587452038-1">
                   <span class="crayon-sy">
                    [
                   </span>
                   <span class="crayon-v">
                    root
                   </span>
                   <span class="crayon-sy">
                    @
                   </span>
                   <span class="crayon-e">
                    facenode1
                   </span>
                   <span class="crayon-v">
                    sbin
                   </span>
                   <span class="crayon-sy">
                    ]
                   </span>
                   <span class="crayon-p">
                    # ps -ef | grep spark
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019343587452038-2">
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    29295
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    11
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    16
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    45
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    pts
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    00
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    00
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    03
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    usr
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    java
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    jdk1
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-cn">
                    6.0_31
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    bin
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    java
                   </span>
                   <span class="crayon-h">
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019343587452038-3">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    cp
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    home
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    zhoumingyao
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-cn">
                    0.9.1
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    bin
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    cdh4
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    conf
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    home
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019343587452038-4">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    zhoumingyao
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-cn">
                    0.9.1
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    bin
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    cdh4
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    assembly
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    target
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    scala
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-cn">
                    2.10
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019343587452038-5">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    assembly_2
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-cn">
                    10
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-cn">
                    0.9.1
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    hadoop2
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-cn">
                    0.0
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    mr1
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    cdh4
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-cn">
                    2.0.jar
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    etc
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    alternatives
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019343587452038-6">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    hadoopconf
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    Dspark
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    akka
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    logLifecycleEvents
                   </span>
                   <span class="crayon-o">
                    =
                   </span>
                   <span class="crayon-t">
                    true
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    Djava
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    library
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    path
                   </span>
                   <span class="crayon-o">
                    =
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    Xms512m
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-e">
                    Xmx512m
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019343587452038-7">
                   <span class="crayon-e">
                   </span>
                   <span class="crayon-v">
                    org
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    apache
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    deploy
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    master
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    Master
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-e">
                    ip
                   </span>
                   <span class="crayon-v">
                    facenode1
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-i">
                    port
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    7077
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    --
                   </span>
                   <span class="crayon-v">
                    webui
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-i">
                    port
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    8080
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019343587452038-8">
                   <span class="crayon-i">
                    root
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    29440
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    12
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    16
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    45
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    ?
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    00
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    00
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    03
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    java
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    cp
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    home
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    zhoumingyao
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019343587452038-9">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-cn">
                    0.9.1
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    bin
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    cdh4
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    conf
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    home
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    zhoumingyao
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-cn">
                    0.9.1
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    bin
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    cdh4
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019343587452038-10">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    assembly
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    target
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    scala
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-cn">
                    2.10
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    assembly_2
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-cn">
                    10
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-cn">
                    0.9.1
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    hadoop2
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-cn">
                    0.0
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    mr1
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    cdh4
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-cn">
                    2.0.jar
                   </span>
                   <span class="crayon-h">
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019343587452038-11">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    Dspark
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    akka
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    logLifecycleEvents
                   </span>
                   <span class="crayon-o">
                    =
                   </span>
                   <span class="crayon-t">
                    true
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    Djava
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    library
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    path
                   </span>
                   <span class="crayon-o">
                    =
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-v">
                    Xms512m
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-e">
                    Xmx512m
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019343587452038-12">
                   <span class="crayon-e">
                   </span>
                   <span class="crayon-v">
                    org
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    apache
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    deploy
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    worker
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    Worker
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-c">
                    //facenode1:7077
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0129 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <p>
          可以启动多个工作站，通过以下命令连接到 master 服务器，如清单 7 所示。
         </p>
         <h5 id="3.0.7. 清单 7. 连接 Master 服务器|outline">
          清单 7. 连接 Master 服务器
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576865801935f896168358" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              ./spark-class org.apache.spark.deploy.worker.Worker spark://facenode1:7077
输出如下：
14/05/06 16:49:06 INFO ui.WorkerWebUI: Started Worker web UI at http://facenode1:8082
14/05/06 16:49:06 INFO worker.Worker: Connecting to master spark://facenode1:7077...
14/05/06 16:49:06 INFO worker.Worker: Successfully registered with master spark://facenode1:7077
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-576865801935f896168358-1">
                   1
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801935f896168358-2">
                   2
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801935f896168358-3">
                   3
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801935f896168358-4">
                   4
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801935f896168358-5">
                   5
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-576865801935f896168358-1">
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-t">
                    class
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    org
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    apache
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    deploy
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    worker
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    Worker
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-c">
                    //facenode1:7077
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801935f896168358-2">
                   输出如下：
                  </div>
                  <div class="crayon-line" id="crayon-576865801935f896168358-3">
                   <span class="crayon-cn">
                    14
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-cn">
                    05
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-cn">
                    06
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    16
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    49
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    06
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    INFO
                   </span>
                   <span class="crayon-v">
                    ui
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    WorkerWebUI
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    Started
                   </span>
                   <span class="crayon-e">
                    Worker
                   </span>
                   <span class="crayon-e">
                    web
                   </span>
                   <span class="crayon-e">
                    UI
                   </span>
                   <span class="crayon-e">
                    at
                   </span>
                   <span class="crayon-v">
                    http
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-c">
                    //facenode1:8082
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801935f896168358-4">
                   <span class="crayon-cn">
                    14
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-cn">
                    05
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-cn">
                    06
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    16
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    49
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    06
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    INFO
                   </span>
                   <span class="crayon-v">
                    worker
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    Worker
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    Connecting
                   </span>
                   <span class="crayon-st">
                    to
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    master
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-c">
                    //facenode1:7077...
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801935f896168358-5">
                   <span class="crayon-cn">
                    14
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-cn">
                    05
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-cn">
                    06
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    16
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    49
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-cn">
                    06
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    INFO
                   </span>
                   <span class="crayon-v">
                    worker
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    Worker
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    Successfully
                   </span>
                   <span class="crayon-e">
                    registered
                   </span>
                   <span class="crayon-e">
                    with
                   </span>
                   <span class="crayon-e">
                    master
                   </span>
                   <span class="crayon-v">
                    spark
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-c">
                    //facenode1:7077
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0037 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <p>
          进入 master server 的 Web UI 可以看到主节点、从节点的工作情况，如清单 8 所示。
         </p>
         <h5 id="3.0.8. 清单 8. 访问 Web 客户端|outline">
          清单 8. 访问 Web 客户端
         </h5>
         <div class="codesection">
          <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
          <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768658019367174629039" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
           <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <span class="crayon-title">
            </span>
            <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-wrap-button" title="切换自动换行">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-expand-button" title="点击展开代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-copy-button" title="复制代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
            </div>
           </div>
           <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
           </div>
           <div class="crayon-plain-wrap">
            <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
             &lt;a href="http://10.10.19.171:8080/"&gt;&lt;code&gt;http://10.10.19.171:8080/&lt;/code&gt;&lt;/a&gt;
            </textarea>
           </div>
           <div class="crayon-main" style="">
            <table class="crayon-table">
             <tbody>
              <tr class="crayon-row">
               <td class="crayon-nums " data-settings="show">
                <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                 <div class="crayon-num" data-line="crayon-5768658019367174629039-1">
                  1
                 </div>
                </div>
               </td>
               <td class="crayon-code">
                <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                 <div class="crayon-line" id="crayon-5768658019367174629039-1">
                  <span class="crayon-o">
                   &lt;
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   href
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-s">
                   "http://10.10.19.171:8080/"
                  </span>
                  <span class="crayon-o">
                   &gt;
                  </span>
                  <span class="crayon-o">
                   &lt;
                  </span>
                  <span class="crayon-v">
                   code
                  </span>
                  <span class="crayon-o">
                   &gt;
                  </span>
                  <span class="crayon-v">
                   http
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-c">
                   //10.10.19.171:8080/&lt;/code&gt;&lt;/a&gt;
                  </span>
                 </div>
                </div>
               </td>
              </tr>
             </tbody>
            </table>
           </div>
          </div>
          <!-- [Format Time: 0.0010 seconds] -->
         </div>
         <p>
          注意，如果是集群方式，请在 conf 文件夹下面的 slaves 文件里面逐行加入需要加入集群的 master、works 服务器的 ip 地址或者 hostname。
         </p>
         <div class="ibm-alternate-rule">
         </div>
         <h2 id="4.MapReduce 转换到 Spark|outline">
          MapReduce 转换到 Spark
         </h2>
         <p>
          Spark 是类似于 MapReduce 的计算引擎，它提出的内存方式解决了 MapReduce 存在的读取磁盘速度较慢的困难，此外，它基于 Scala 的函数式编程风格和 API，进行并行计算时效率很高。
         </p>
         <p>
          由于 Spark 采用的是 RDD(弹性分布式结果集) 方式对数据进行计算，这种方式与 MapReduce 的 Map()、Reduce() 方式差距较大，所以很难直接使用 Mapper、Reducer 的 API，这也是阻碍 MapReduce 转为 Spark 的绊脚石。
         </p>
         <p>
          Scala 或者 Spark 里面的 map() 和 reduce() 方法与 Hadoop MapReduce 里面的 map()、reduce() 方法相比，Hadoop MapReduce 的 API 更加灵活和复杂，下面列出了 Hadoop MapReduce 的一些特性：
         </p>
         <ol type="1">
          <li>
           Mappers 和 Reducers 通常使用 key-value 键值对作为输入和输出；
          </li>
          <li>
           一个 key 对应一个 Reducer 的 reduce；
          </li>
          <li>
           每一个 Mapper 或者 Reducer 可能发出类似于 0,1 这样的键值对作为每一次输出；
          </li>
          <li>
           Mappers 和 Reducers 可能发出任意的 key 或者 value，而不是标准数据集方式；
          </li>
          <li>
           Mapper 和 Reducer 对象对每一次 map() 和 reduce() 的调用都存在生命周期。它们支持一个 setup() 方法和 cleanup() 方法，这些方法可以被用来在处理批量数据之前的操作。
          </li>
         </ol>
         <p>
          试想这么一个场景，我们需要计算一个文本文件里每一行的字符数量。在 Hadoop MapReduce 里，我们需要为 Mapper 方法准备一个键值对，key 用作行的行数，value 的值是这一行的字符数量。
         </p>
         <h5 id="4.0.1. 清单 9. MapReduce 方式 Map 函数|outline">
          清单 9. MapReduce 方式 Map 函数
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576865801936f398347822" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              public class LineLengthCountMapper
 extends Mapper&amp;lt;LongWritable,Text,IntWritable,IntWritable&amp;gt; {
 @Override
 protected void map(LongWritable lineNumber, Text line, Context context)
 throws IOException, InterruptedException {
 context.write(new IntWritable(line.getLength()), new IntWritable(1));
 }
}
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-576865801936f398347822-1">
                   1
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801936f398347822-2">
                   2
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801936f398347822-3">
                   3
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801936f398347822-4">
                   4
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801936f398347822-5">
                   5
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801936f398347822-6">
                   6
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801936f398347822-7">
                   7
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801936f398347822-8">
                   8
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-576865801936f398347822-1">
                   <span class="crayon-m">
                    public
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    class
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    LineLengthCountMapper
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801936f398347822-2">
                   <span class="crayon-e">
                   </span>
                   <span class="crayon-r">
                    extends
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    Mapper
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    lt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-v">
                    LongWritable
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    Text
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    IntWritable
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    IntWritable
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801936f398347822-3">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    @
                   </span>
                   <span class="crayon-e">
                    Override
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801936f398347822-4">
                   <span class="crayon-e">
                   </span>
                   <span class="crayon-m">
                    protected
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    void
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    map
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-e">
                    LongWritable
                   </span>
                   <span class="crayon-v">
                    lineNumber
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    Text
                   </span>
                   <span class="crayon-v">
                    line
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    Context
                   </span>
                   <span class="crayon-v">
                    context
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801936f398347822-5">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    throws
                   </span>
                   <span class="crayon-v">
                    IOException
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    InterruptedException
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801936f398347822-6">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    context
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    write
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-r">
                    new
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    IntWritable
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-v">
                    line
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    getLength
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-r">
                    new
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    IntWritable
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801936f398347822-7">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801936f398347822-8">
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0091 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <p>
          清单 9 所示代码，由于 Mappers 和 Reducers 只处理键值对，所以对于类 LineLengthCountMapper 而言，输入是 TextInputFormat 对象，它的 key 由行数提供，value 就是该行所有字符。换成 Spark 之后的代码如清单 10 所示。
         </p>
         <h5 id="4.0.2. 清单 10. Spark 方式 Map 函数|outline">
          清单 10. Spark 方式 Map 函数
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768658019376768950622" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              lines.map(line =&amp;gt; (line.length, 1))
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-5768658019376768950622-1">
                   1
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-5768658019376768950622-1">
                   <span class="crayon-v">
                    lines
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    map
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-v">
                    line
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    =&amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-v">
                    line
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    length
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0090 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <p>
          在 Spark 里，输入是弹性分布式数据集 (Resilient Distributed Dataset)，Spark 不需要 key-value 键值对，代之的是 Scala 元祖 (tuple)，它是通过 (line.length, 1) 这样的 (a,b) 语法创建的。以上代码中 map() 操作是一个 RDD，(line.length, 1) 元祖。当一个 RDD 包含元祖时，它依赖于其他方法，例如 reduceByKey()，该方法对于重新生成 MapReduce 特性具有重要意义。
         </p>
         <p>
          清单 11 所示代码是 Hadoop MapReduce 统计每一行的字符数，然后以 Reduce 方式输出。
         </p>
         <h5 id="4.0.3. 清单 11. MapReduce 方式 Reduce 函数|outline">
          清单 11. MapReduce 方式 Reduce 函数
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576865801937c438955837" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              public class LineLengthReducer
 extends Reducer&amp;lt;IntWritable,IntWritable,IntWritable,IntWritable&amp;gt; {
 @Override
 protected void reduce(IntWritable length, Iterable&amp;lt;IntWritable&amp;gt; counts, Context context)
 throws IOException, InterruptedException {
 int sum = 0;
 for (IntWritable count : counts) {
 sum += count.get();
 }
 context.write(length, new IntWritable(sum));
 }
}
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-576865801937c438955837-1">
                   1
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801937c438955837-2">
                   2
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801937c438955837-3">
                   3
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801937c438955837-4">
                   4
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801937c438955837-5">
                   5
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801937c438955837-6">
                   6
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801937c438955837-7">
                   7
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801937c438955837-8">
                   8
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801937c438955837-9">
                   9
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801937c438955837-10">
                   10
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801937c438955837-11">
                   11
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801937c438955837-12">
                   12
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-576865801937c438955837-1">
                   <span class="crayon-m">
                    public
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    class
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    LineLengthReducer
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801937c438955837-2">
                   <span class="crayon-e">
                   </span>
                   <span class="crayon-r">
                    extends
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    Reducer
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    lt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-v">
                    IntWritable
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    IntWritable
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    IntWritable
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    IntWritable
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801937c438955837-3">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    @
                   </span>
                   <span class="crayon-e">
                    Override
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801937c438955837-4">
                   <span class="crayon-e">
                   </span>
                   <span class="crayon-m">
                    protected
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    void
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    reduce
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-e">
                    IntWritable
                   </span>
                   <span class="crayon-v">
                    length
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    Iterable
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    lt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-v">
                    IntWritable
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    counts
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    Context
                   </span>
                   <span class="crayon-v">
                    context
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801937c438955837-5">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    throws
                   </span>
                   <span class="crayon-v">
                    IOException
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    InterruptedException
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801937c438955837-6">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    int
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    sum
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    =
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    0
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801937c438955837-7">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-st">
                    for
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-e">
                    IntWritable
                   </span>
                   <span class="crayon-v">
                    count
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    counts
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801937c438955837-8">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    sum
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    +=
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    count
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    get
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801937c438955837-9">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801937c438955837-10">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    context
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    write
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-v">
                    length
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-r">
                    new
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    IntWritable
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-v">
                    sum
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801937c438955837-11">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801937c438955837-12">
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0115 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <p>
          Spark 里面的对应代码如清单 12 所示。
         </p>
         <h5 id="4.0.4. 清单 12. Spark 方式 Reduce 函数|outline">
          清单 12. Spark 方式 Reduce 函数
         </h5>
         <div class="codesection">
          <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
          <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768658019382013545782" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
           <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <span class="crayon-title">
            </span>
            <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-wrap-button" title="切换自动换行">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-expand-button" title="点击展开代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-copy-button" title="复制代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
            </div>
           </div>
           <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
           </div>
           <div class="crayon-plain-wrap">
            <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
             val lengthCounts = lines.map(line =&amp;gt; (line.length, 1)).reduceByKey(_ + _)
            </textarea>
           </div>
           <div class="crayon-main" style="">
            <table class="crayon-table">
             <tbody>
              <tr class="crayon-row">
               <td class="crayon-nums " data-settings="show">
                <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                 <div class="crayon-num" data-line="crayon-5768658019382013545782-1">
                  1
                 </div>
                </div>
               </td>
               <td class="crayon-code">
                <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                 <div class="crayon-line" id="crayon-5768658019382013545782-1">
                  <span class="crayon-e">
                   val
                  </span>
                  <span class="crayon-v">
                   lengthCounts
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   lines
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-e">
                   map
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   line
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =&amp;
                  </span>
                  <span class="crayon-v">
                   gt
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   line
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   length
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-e">
                   reduceByKey
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   _
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   _
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                </div>
               </td>
              </tr>
             </tbody>
            </table>
           </div>
          </div>
          <!-- [Format Time: 0.0095 seconds] -->
         </div>
         <p>
          Spark 的 RDD API 有一个 reduce() 方法，它会 reduce 所有的 key-value 键值对到一个独立的 value。
         </p>
         <p>
          我们现在需要统计大写字母开头的单词数量，对于文本的每一行而言，一个 Mapper 可能需要统计很多个键值对，代码如清单 13 所示。
         </p>
         <h5 id="4.0.5. 清单 13. MapReduce 方式计算字符数量|outline">
          清单 13. MapReduce 方式计算字符数量
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768658019388548744066" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              public class CountUppercaseMapper
 extends Mapper&amp;lt;LongWritable,Text,Text,IntWritable&amp;gt; {
 @Override
 protected void map(LongWritable lineNumber, Text line, Context context)
 throws IOException, InterruptedException {
 for (String word : line.toString().split(" ")) {
 if (Character.isUpperCase(word.charAt(0))) {
 context.write(new Text(word), new IntWritable(1));
 }
 }
 }
}
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-5768658019388548744066-1">
                   1
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019388548744066-2">
                   2
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019388548744066-3">
                   3
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019388548744066-4">
                   4
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019388548744066-5">
                   5
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019388548744066-6">
                   6
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019388548744066-7">
                   7
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019388548744066-8">
                   8
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019388548744066-9">
                   9
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019388548744066-10">
                   10
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019388548744066-11">
                   11
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019388548744066-12">
                   12
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-5768658019388548744066-1">
                   <span class="crayon-m">
                    public
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    class
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    CountUppercaseMapper
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019388548744066-2">
                   <span class="crayon-e">
                   </span>
                   <span class="crayon-r">
                    extends
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    Mapper
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    lt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-v">
                    LongWritable
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    Text
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    Text
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    IntWritable
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019388548744066-3">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    @
                   </span>
                   <span class="crayon-e">
                    Override
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019388548744066-4">
                   <span class="crayon-e">
                   </span>
                   <span class="crayon-m">
                    protected
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    void
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    map
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-e">
                    LongWritable
                   </span>
                   <span class="crayon-v">
                    lineNumber
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    Text
                   </span>
                   <span class="crayon-v">
                    line
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    Context
                   </span>
                   <span class="crayon-v">
                    context
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019388548744066-5">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    throws
                   </span>
                   <span class="crayon-v">
                    IOException
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    InterruptedException
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019388548744066-6">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-st">
                    for
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-t">
                    String
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    word
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    line
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    toString
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    split
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-s">
                    " "
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019388548744066-7">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-st">
                    if
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-v">
                    Character
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    isUpperCase
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-t">
                    word
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    charAt
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-cn">
                    0
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019388548744066-8">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    context
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    write
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-r">
                    new
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    Text
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-t">
                    word
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-r">
                    new
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    IntWritable
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019388548744066-9">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019388548744066-10">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019388548744066-11">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019388548744066-12">
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0176 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <p>
          在 Spark 里面，对应的代码如清单 14 所示。
         </p>
         <h5 id="4.0.6. 清单 14. Spark 方式计算字符数量|outline">
          清单 14. Spark 方式计算字符数量
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576865801938f258794967" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              lines.flatMap(
_.split(" ").filter(word =&amp;gt; Character.isUpperCase(word(0))).map(word =&amp;gt; (word,1))
)
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-576865801938f258794967-1">
                   1
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-576865801938f258794967-2">
                   2
                  </div>
                  <div class="crayon-num" data-line="crayon-576865801938f258794967-3">
                   3
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-576865801938f258794967-1">
                   <span class="crayon-v">
                    lines
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    flatMap
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-576865801938f258794967-2">
                   <span class="crayon-v">
                    _
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    split
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-s">
                    " "
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    filter
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-t">
                    word
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    =&amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    Character
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    isUpperCase
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-t">
                    word
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-cn">
                    0
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    map
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-t">
                    word
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    =&amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-t">
                    word
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-cn">
                    1
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-576865801938f258794967-3">
                   <span class="crayon-sy">
                    )
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0020 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <p>
          MapReduce 依赖的 Map 方法这里并不适用，因为每一个输入必须对应一个输出，这样的话，每一行可能占用到很多的输出。相反的，Spark 里面的 Map 方法比较简单。Spark 里面的方法是，首先对每一行数据进行汇总后存入一个输出结果物数组，这个数组可能是空的，也可能包含了很多的值，最终这个数组会作为一个 RDD 作为输出物。这就是 flatMap() 方法的功能，它对每一行文本里的单词转换成函数内部的元组后进行了过滤。
         </p>
         <p>
          在 Spark 里面，reduceByKey() 方法可以被用来统计每篇文章里面出现的字母数量。如果我们想统计每一篇文章里面出现的大写字母数量，在 MapReduce 里程序可以如清单 15 所示。
         </p>
         <h5 id="4.0.7. 清单 15. MapReduce 方式|outline">
          清单 15. MapReduce 方式
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768658019395243577600" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              public class CountUppercaseReducer
 extends Reducer&amp;lt;Text,IntWritable,Text,IntWritable&amp;gt; {
 @Override
 protected void reduce(Text word, Iterable&amp;lt;IntWritable&amp;gt; counts, Context context)
 throws IOException, InterruptedException {
 int sum = 0;
 for (IntWritable count : counts) {
 sum += count.get();
 }
 context.write(new Text(word.toString().toUpperCase()), new IntWritable(sum));
 }
}
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-5768658019395243577600-1">
                   1
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019395243577600-2">
                   2
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019395243577600-3">
                   3
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019395243577600-4">
                   4
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019395243577600-5">
                   5
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019395243577600-6">
                   6
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019395243577600-7">
                   7
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019395243577600-8">
                   8
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019395243577600-9">
                   9
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019395243577600-10">
                   10
                  </div>
                  <div class="crayon-num" data-line="crayon-5768658019395243577600-11">
                   11
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-5768658019395243577600-12">
                   12
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-5768658019395243577600-1">
                   <span class="crayon-m">
                    public
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    class
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    CountUppercaseReducer
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019395243577600-2">
                   <span class="crayon-e">
                   </span>
                   <span class="crayon-r">
                    extends
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    Reducer
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    lt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-v">
                    Text
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    IntWritable
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    Text
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    IntWritable
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019395243577600-3">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    @
                   </span>
                   <span class="crayon-e">
                    Override
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019395243577600-4">
                   <span class="crayon-e">
                   </span>
                   <span class="crayon-m">
                    protected
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    void
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    reduce
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-e">
                    Text
                   </span>
                   <span class="crayon-t">
                    word
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    Iterable
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    lt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-v">
                    IntWritable
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    counts
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    Context
                   </span>
                   <span class="crayon-v">
                    context
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019395243577600-5">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    throws
                   </span>
                   <span class="crayon-v">
                    IOException
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    InterruptedException
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019395243577600-6">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    int
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    sum
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    =
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-cn">
                    0
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019395243577600-7">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-st">
                    for
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-e">
                    IntWritable
                   </span>
                   <span class="crayon-v">
                    count
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    counts
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019395243577600-8">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    sum
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    +=
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    count
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    get
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019395243577600-9">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019395243577600-10">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    context
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    write
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-r">
                    new
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    Text
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-t">
                    word
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    toString
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    toUpperCase
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-r">
                    new
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    IntWritable
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-v">
                    sum
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-5768658019395243577600-11">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-5768658019395243577600-12">
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0048 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <p>
          在 Spark 里，代码如清单 16 所示。
         </p>
         <h5 id="4.0.8. 清单 16. Spark 方式|outline">
          清单 16. Spark 方式
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576865801939b599684078" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              groupByKey().map { case (word,ones) =&amp;gt; (word.toUpperCase, ones.sum) }
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-576865801939b599684078-1">
                   1
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-576865801939b599684078-1">
                   <span class="crayon-e">
                    groupByKey
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-i">
                    map
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-st">
                    case
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-t">
                    word
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    ones
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    =&amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-t">
                    word
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    toUpperCase
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    ones
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-v">
                    sum
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0017 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <p>
          groupByKey() 方法负责收集一个 key 的所有值，不应用于一个 reduce 方法。本例中，key 被转换成大写字母，值被直接相加算出总和。但这里需要注意，如果一个 key 与很多个 value 相关联，可能会出现 Out Of Memory 错误。
         </p>
         <p>
          Spark 提供了一个简单的方法可以转换 key 对应的值，这个方法把 reduce 方法过程移交给了 Spark，可以避免出现 OOM 异常。
         </p>
         <p>
          reduceByKey(_ + _).map { case (word,total) =&gt; (word.toUpperCase,total) }
         </p>
         <p>
          setup() 方法在 MapReduce 里面主要的作用是在 map 方法开始前对输入进行处理，常用的场景是连接数据库，可以在 cleanup() 方法中释放在 setup() 方法里面占用的资源。
         </p>
         <h5 id="4.0.9. 清单 17. MapReduce 方式|outline">
          清单 17. MapReduce 方式
         </h5>
         <div class="codesection">
          <blockquote>
           <p>
           </p>
           <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
           <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686580193a2126294180" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
            <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-title">
             </span>
             <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
              <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-wrap-button" title="切换自动换行">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-expand-button" title="点击展开代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-copy-button" title="复制代码">
               <div class="crayon-button-icon">
               </div>
              </div>
              <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
               <div class="crayon-button-icon">
               </div>
              </div>
             </div>
            </div>
            <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
            </div>
            <div class="crayon-plain-wrap">
             <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
              public class SetupCleanupMapper extends Mapper&amp;lt;LongWritable,Text,Text,IntWritable&amp;gt; {
 private Connection dbConnection;
 @Override
 protected void setup(Context context) {
 dbConnection = ...;
 }
 ...
 @Override
 protected void cleanup(Context context) {
 dbConnection.close();
 }
}
             </textarea>
            </div>
            <div class="crayon-main" style="">
             <table class="crayon-table">
              <tbody>
               <tr class="crayon-row">
                <td class="crayon-nums " data-settings="show">
                 <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                  <div class="crayon-num" data-line="crayon-57686580193a2126294180-1">
                   1
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-57686580193a2126294180-2">
                   2
                  </div>
                  <div class="crayon-num" data-line="crayon-57686580193a2126294180-3">
                   3
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-57686580193a2126294180-4">
                   4
                  </div>
                  <div class="crayon-num" data-line="crayon-57686580193a2126294180-5">
                   5
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-57686580193a2126294180-6">
                   6
                  </div>
                  <div class="crayon-num" data-line="crayon-57686580193a2126294180-7">
                   7
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-57686580193a2126294180-8">
                   8
                  </div>
                  <div class="crayon-num" data-line="crayon-57686580193a2126294180-9">
                   9
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-57686580193a2126294180-10">
                   10
                  </div>
                  <div class="crayon-num" data-line="crayon-57686580193a2126294180-11">
                   11
                  </div>
                  <div class="crayon-num crayon-striped-num" data-line="crayon-57686580193a2126294180-12">
                   12
                  </div>
                 </div>
                </td>
                <td class="crayon-code">
                 <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                  <div class="crayon-line" id="crayon-57686580193a2126294180-1">
                   <span class="crayon-m">
                    public
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    class
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    SetupCleanupMapper
                   </span>
                   <span class="crayon-r">
                    extends
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    Mapper
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    lt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-v">
                    LongWritable
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    Text
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    Text
                   </span>
                   <span class="crayon-sy">
                    ,
                   </span>
                   <span class="crayon-v">
                    IntWritable
                   </span>
                   <span class="crayon-o">
                    &amp;
                   </span>
                   <span class="crayon-v">
                    gt
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-57686580193a2126294180-2">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-m">
                    private
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    Connection
                   </span>
                   <span class="crayon-v">
                    dbConnection
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-57686580193a2126294180-3">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    @
                   </span>
                   <span class="crayon-e">
                    Override
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-57686580193a2126294180-4">
                   <span class="crayon-e">
                   </span>
                   <span class="crayon-m">
                    protected
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    void
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    setup
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-e">
                    Context
                   </span>
                   <span class="crayon-v">
                    context
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-57686580193a2126294180-5">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    dbConnection
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    =
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-57686580193a2126294180-6">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-57686580193a2126294180-7">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-57686580193a2126294180-8">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    @
                   </span>
                   <span class="crayon-e">
                    Override
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-57686580193a2126294180-9">
                   <span class="crayon-e">
                   </span>
                   <span class="crayon-m">
                    protected
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-t">
                    void
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-e">
                    cleanup
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-e">
                    Context
                   </span>
                   <span class="crayon-v">
                    context
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    {
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-57686580193a2126294180-10">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    dbConnection
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                   <span class="crayon-e">
                    close
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                  </div>
                  <div class="crayon-line" id="crayon-57686580193a2126294180-11">
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                  <div class="crayon-line crayon-striped-line" id="crayon-57686580193a2126294180-12">
                   <span class="crayon-sy">
                    }
                   </span>
                  </div>
                 </div>
                </td>
               </tr>
              </tbody>
             </table>
            </div>
           </div>
           <!-- [Format Time: 0.0040 seconds] -->
           <p>
           </p>
          </blockquote>
         </div>
         <p>
          在 Spark 里面没有这样的方法。
         </p>
         <div class="ibm-alternate-rule">
         </div>
         <h2 id="1. 结束语|outline">
          结束语
         </h2>
         <p>
          通过本文的学习，读者了解了 MapReduce 和 Spark 之间的差异及切换成本。本文针对的是对 Spark 完全没有了解的用户，后续文章会从实际应用出发，从安装、应用程序的角度给出更加实际的教程。
         </p>
        </div>
       </div>
       <div class="ibm-columns">
        <div class="ibm-col-6-4">
         <h2 class="ibm-rule" id="resources">
          参考资料
         </h2>
         <h3 class="dw-resources-category-heading">
          学习
         </h3>
         <ul class="ibm-bullet-list">
          <li>
           参考
           <a href="http://www.ibm.com/search/csass/search/?q=Spark&amp;sn=dw&amp;lang=zh&amp;cc=CN&amp;en=utf&amp;hpp=20&amp;dws=cndw&amp;lo=zh">
            Spark 文档
           </a>
           首页，了解 IBM 开发者论坛已经收录的 Spark 文章。
          </li>
          <li>
           参考
           <a href="http://www.cloudera.com/content/cloudera-content/cloudera-docs/">
            Cloudera Spark 文档
           </a>
           首页，了解 Spark 原理。
          </li>
          <li>
           &gt;参考书籍《Spark 大数据处理技术》，作者作为 Spark 社区的主要推动者，对于 Spark 技术有深入的介绍。
          </li>
          <li>
           <a href="http://www.ibm.com/developerworks/cn/opensource/">
            developerWorks 开源技术主题
           </a>
           ：查找丰富的操作信息、工具和项目更新，帮助您掌握开源技术并将其用于 IBM 产品。
          </li>
         </ul>
        </div>
       </div>
      </div>
      <div>
       <strong>
        注：转载文章均来自于公开网络，仅供学习使用，不会用于任何商业用途，如果侵犯到原作者的权益，请您与我们联系删除或者授权事宜，联系邮箱：contact@dataunion.org。转载数盟网站文章请注明原文章作者，否则产生的任何版权纠纷与数盟无关。
       </strong>
      </div>
      <!--content_text-->
      <div class="fenxian">
       <!-- JiaThis Button BEGIN -->
       <div class="jiathis_style_32x32">
        <p class="jiathis_button_weixin">
        </p>
        <p class="jiathis_button_tsina">
        </p>
        <p class="jiathis_button_qzone">
        </p>
        <p class="jiathis_button_cqq">
        </p>
        <p class="jiathis_button_tumblr">
        </p>
        <a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">
        </a>
        <p class="jiathis_counter_style">
        </p>
       </div>
       <!-- JiaThis Button END -->
      </div>
     </article>
     <!--content-->
     <!--相关文章-->
     <div class="xianguan">
      <div class="xianguantitle">
       相关文章！
      </div>
      <ul class="pic">
       <li>
        <a href="http://dataunion.org/20824.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/09/t018630756a7e263b33-300x165.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20824.html" rel="bookmark" title="如何判断一笔交易是否属于欺诈？你只是需要一点数据挖掘">
         如何判断一笔交易是否属于欺诈？你只是需要一点数据挖掘
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/20820.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/09/1-300x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20820.html" rel="bookmark" title="人们对Python在企业级开发中的10大误解">
         人们对Python在企业级开发中的10大误解
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/20811.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/09/t0133fcacae8523307b_副本-300x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20811.html" rel="bookmark" title="大神亲传：26条深度学习的金科玉律！">
         大神亲传：26条深度学习的金科玉律！
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/20808.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/09/640.webp-11-300x137.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20808.html" rel="bookmark" title="我们是如何在一张地图上表现86万个数据的">
         我们是如何在一张地图上表现86万个数据的
        </a>
       </li>
      </ul>
     </div>
     <!--相关文章-->
     <div class="comment" id="comments">
      <!-- You can start editing here. -->
      <!-- If comments are open, but there are no comments. -->
      <div class="title">
       期待你一针见血的评论，Come on！
      </div>
      <div id="respond">
       <p>
        不用想啦，马上
        <a href="http://dataunion.org/wp-login.php?redirect_to=http%3A%2F%2Fdataunion.org%2F19040.html">
         "登录"
        </a>
        发表自已的想法.
       </p>
      </div>
     </div>
     <!-- .nav-single -->
    </div>
    <!--Container End-->
    <aside id="sitebar">
     <div class="sitebar_list2">
      <div class="wptag">
       <span class="tagtitle">
        热门标签+
       </span>
       <div class="tagg">
        <ul class="menu" id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1605" id="menu-item-1605">
          <a href="http://taidizh.com/">
           泰迪智慧
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20884" id="menu-item-20884">
          <a href="http://www.transwarp.cn/">
           星环科技
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3538" id="menu-item-3538">
          <a href="http://datall.org/">
           珈和遥感
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20888" id="menu-item-20888">
          <a href="http://www.chinahadoop.cn/">
           小象学院
          </a>
         </li>
        </ul>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <div class="textwidget">
       <div align="center">
        <a href="http://study.163.com/course/courseMain.htm?courseId=991022" target="_blank">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/dv.jpg"/>
        </a>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       文章分类
      </h4>
      <div class="tagcloud">
       <a class="tag-link-44" href="http://dataunion.org/category/industry/demo" style="font-size: 10.204724409449pt;" title="4个话题">
        Demo展示
       </a>
       <a class="tag-link-31" href="http://dataunion.org/category/experts" style="font-size: 15.826771653543pt;" title="52个话题">
        专家团队
       </a>
       <a class="tag-link-870" href="http://dataunion.org/category/tech/ai" style="font-size: 19.795275590551pt;" title="273个话题">
        人工智能
       </a>
       <a class="tag-link-488" href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f" style="font-size: 8pt;" title="1个话题">
        加入数盟
       </a>
       <a class="tag-link-869" href="http://dataunion.org/category/tech/viz" style="font-size: 17.204724409449pt;" title="93个话题">
        可视化
       </a>
       <a class="tag-link-30" href="http://dataunion.org/category/partners" style="font-size: 10.645669291339pt;" title="5个话题">
        合作伙伴
       </a>
       <a class="tag-link-889" href="http://dataunion.org/category/parterc" style="font-size: 11.582677165354pt;" title="8个话题">
        合作会议
       </a>
       <a class="tag-link-104" href="http://dataunion.org/category/books" style="font-size: 12.96062992126pt;" title="15个话题">
        图书
       </a>
       <a class="tag-link-220" href="http://dataunion.org/category/tech/base" style="font-size: 19.850393700787pt;" title="281个话题">
        基础架构
       </a>
       <a class="tag-link-219" href="http://dataunion.org/category/tech/analysis" style="font-size: 19.409448818898pt;" title="232个话题">
        数据分析
       </a>
       <a class="tag-link-887" href="http://dataunion.org/category/tech/dm" style="font-size: 13.291338582677pt;" title="17个话题">
        数据挖掘
       </a>
       <a class="tag-link-34" href="http://dataunion.org/category/tech" style="font-size: 20.732283464567pt;" title="404个话题">
        文章
       </a>
       <a class="tag-link-1" href="http://dataunion.org/category/uncategorized" style="font-size: 22pt;" title="693个话题">
        未分类
       </a>
       <a class="tag-link-4" href="http://dataunion.org/category/events" style="font-size: 14.503937007874pt;" title="29个话题">
        活动
       </a>
       <a class="tag-link-890" href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" style="font-size: 10.204724409449pt;" title="4个话题">
        深度学习
       </a>
       <a class="tag-link-221" href="http://dataunion.org/category/tech/devl" style="font-size: 18.968503937008pt;" title="193个话题">
        编程语言
       </a>
       <a class="tag-link-888" href="http://dataunion.org/category/career" style="font-size: 15.661417322835pt;" title="48个话题">
        职业规划
       </a>
       <a class="tag-link-5" href="http://dataunion.org/category/jobs" style="font-size: 14.11811023622pt;" title="25个话题">
        职位
       </a>
       <a class="tag-link-871" href="http://dataunion.org/category/industry" style="font-size: 15.716535433071pt;" title="49个话题">
        行业
       </a>
       <a class="tag-link-613" href="http://dataunion.org/category/industry/case" style="font-size: 16.984251968504pt;" title="84个话题">
        行业应用
       </a>
       <a class="tag-link-885" href="http://dataunion.org/category/industry/news" style="font-size: 17.425196850394pt;" title="102个话题">
        行业资讯
       </a>
       <a class="tag-link-10" href="http://dataunion.org/category/training" style="font-size: 14.228346456693pt;" title="26个话题">
        课程
       </a>
       <a class="tag-link-16" href="http://dataunion.org/category/sources" style="font-size: 15.661417322835pt;" title="48个话题">
        资源
       </a>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       功能
      </h4>
      <ul>
       <li>
        <a href="http://dataunion.org/wp-login.php?action=register">
         注册
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/wp-login.php">
         登录
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/feed">
         文章
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/comments/feed">
         评论
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="https://cn.wordpress.org/" title="基于WordPress，一个优美、先进的个人信息发布平台。">
         WordPress.org
        </a>
       </li>
      </ul>
     </div>
    </aside>
    <div class="clear">
    </div>
   </div>
   <!--main-->
   ﻿
   <footer id="dibu">
    <div class="about">
     <div class="right">
      <ul class="menu" id="menu-%e5%ba%95%e9%83%a8%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18024" id="menu-item-18024">
        <a href="http://dataunion.org/category/partners">
         合作伙伴
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20881" id="menu-item-20881">
        <a href="http://dataunion.org/contribute">
         文章投稿
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20872" id="menu-item-20872">
        <a href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f">
         加入数盟
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22441" id="menu-item-22441">
        <a href="http://dataunion.org/f-links">
         友情链接
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20874" id="menu-item-20874">
        <a href="http://dataunion.org/aboutus">
         关于数盟
        </a>
       </li>
      </ul>
      <p class="banquan">
       数盟社区        ，
        做最棒的数据科学社区
      </p>
     </div>
     <div class="left">
      <ul class="bottomlist">
       <li>
        <a href="http://weibo.com/DataScientistUnion  " target="_blank" 　title="">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weibo.png"/>
        </a>
       </li>
       <li>
        <a class="cd-popup-trigger" href="http://dataunion.org/19040.html#0">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weixin.png"/>
        </a>
       </li>
      </ul>
      <div class="cd-popup">
       <div class="cd-popup-container">
        <h1>
         扫描二维码,加微信公众号
        </h1>
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/2014-12-06-1515289049.png"/>
        <a class="cd-popup-close" href="http://dataunion.org/19040.html">
        </a>
       </div>
       <!-- cd-popup-container -->
      </div>
      <!-- cd-popup -->
     </div>
    </div>
    <!--about-->
    <div class="bottom">
     <a href="http://dataunion.org/">
      数盟社区
     </a>
     <a href="http://www.miitbeian.gov.cn/" rel="external nofollow" target="_blank">
      京ICP备14026740号
     </a>
     联系我们：
     <a href="mailto:contact@dataunion.org" target="_blank">
      contact@dataunion.org
     </a>
     <div class="tongji">
     </div>
     <!--bottom-->
     <div class="scroll" id="scroll" style="display:none;">
      ︿
     </div>
    </div>
   </footer>
   <!--dibu-->
  </div>
 </body>
</html>